Skip to content

refactor(dashboard): cut over to the Bun workspace SDK - #13

Open
phibkro wants to merge 1 commit into
publish/0004-team-domainfrom
publish/0010-dashboard-sdk
Open

refactor(dashboard): cut over to the Bun workspace SDK#13
phibkro wants to merge 1 commit into
publish/0004-team-domainfrom
publish/0010-dashboard-sdk

Conversation

@phibkro

@phibkro phibkro commented Aug 12, 2026

Copy link
Copy Markdown
Member

Design spec

design-specs/0010-dashboard-bun-sdk-resolution.md

Journey

A dashboard maintainer uses one Bun workspace SDK authority for cold install, build, auth/public/admin routes, and the Receipt consumer journey without duplicated wire clients.

Experience it

  1. Check out this stacked branch.
  2. Follow the cold SDK build, W0 baseline, and Receipt journey commands in the spec.
  3. Inspect the recorded request, error, and cleanup evidence.

Evidence

  • Independent code/runtime review: PASS for the accepted 0010 capsule.
  • The Receipt paths from the consumed 0008 contract are reviewed here under 0010 §4.5/§6.2 S5.
  • Dashboard package and README are deliberately the pre-0012 state; the next PR owns W0 fixture changes.

What is real

The workspace SDK cutover, cold build boundary, and Receipt journey are real. Nine unrelated dashboard type diagnostics remain; this PR does not claim a broad-green dashboard, backend parity, provider behavior, deployment, or production acceptance.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37ed756a1c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"vaul": "^1.1.2",
"zod": "^3.24.2",
"@vektorprogrammet/sdk": "^0.1.2",
"@vektorprogrammet/sdk": "workspace:*",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Align the profile endpoint before selecting the workspace SDK

With this workspace dependency selected, every non-fixture dashboard request reaches the parent loader's client.me.profile(). The local client sends GET /api/me/profile (packages/sdk/src/domains/me.ts:15-16), but the backend only registers GET /api/me (apps/server/src/App/Identity/Api/Resource/ProfileResource.php:14-17); the new fixture masks this mismatch by implementing the nonexistent /api/me/profile route. Against the real backend the profile request returns 404, the parent loader redirects to login, and the login loader redirects the still-authenticated cookie back to the dashboard, preventing users from entering the application.

Useful? React with 👍 / 👎.

Comment on lines 87 to +88
const result = await client.receipts.list(status ? { status } : undefined);
return { receipts: result.items as Receipt[] };
} catch {
return { receipts: [] };
return { receipts: result.items.map(mapReceiptView), error: undefined };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use the backend's user receipt collection endpoint

When Mine Utlegg loads against the real backend, the workspace SDK's receipts.list() sends GET /api/receipts (packages/sdk/src/domains/receipts.ts:20), while the server registers the user-scoped collection at /api/my/receipts (apps/server/src/App/Operations/Api/Resource/UserReceiptListResource.php:13-16) and exposes /api/receipts only for creation. The added stub implements GET /api/receipts, so the browser test passes despite production returning a method/route error and this loader rendering an empty receipt table with an error.

Useful? React with 👍 / 👎.

Comment on lines 56 to +57
const result = await client.admin.receipts.list(status ? { status } : undefined);
return { receipts: result.items as Receipt[] };
} catch {
return { receipts: [] };
return { receipts: result.items.map(mapAdminReceiptView), error: undefined };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Match the admin receipt schema to the server payload

Whenever the admin collection contains a receipt, the workspace SDK requires every AdminReceipt to contain refundDate (packages/sdk/src/schemas/receipt.ts:18-27), but the backend's AdminReceiptListResource has no such property (apps/server/src/App/Operations/Api/Resource/AdminReceiptListResource.php:21-30) and its provider never populates one. Collection decoding therefore throws a ValidationError before this mapping runs, causing the loader to replace all real admin receipts with an empty list; the new fixture masks the incompatibility by supplying refundDate on its synthetic admin rows.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant